#include <stdio.h>
//输入一行字符，分别统计出其中的英文字母、空格、数字和其他字符的个数
void main()
{
    int c,letters=0;
    int spaces = 0;
    int nums = 0;
    int others = 0;
    printf("please enter a string:");
    while((c=getchar()) != '\n')
    {
        if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <='Z'))
        letters++;
        else if (c == ' ')
        spaces++;
        else if( c >= '0' && c <= '9')
        nums++;
        else
        others++;
    }
    printf("letters: %d\nnums: %d\nspaces: %d\nothers: %d\n",letters,nums,spaces,others);

}